/* local prototypes */
-static int TPM_Send(tpmState *s, tpmBuffer *buffer, char *msg);
+static int TPM_Send(tpmState *s, tpmBuffer *buffer, uint8_t locty, char *msg);
static int TPM_Receive(tpmState *s, tpmBuffer *buffer);
static uint32_t vtpm_instance_from_xenstore(void);
static void tis_poll_timer(void *opaque);
/*
* the 'write' method for sending requests to the vTPM
* four bytes with the vTPM instance number are prepended to each request
+ * the locality in which the command was sent is transmitted in the
+ * highest 3 bits
*/
static int write_local_socket(tpmState *s, const tpmBuffer *buffer)
{
}
}
if (val & STS_TPM_GO) {
- n = TPM_Send(s, &s->buffer,"tpm_data_write");
+ n = TPM_Send(s, &s->buffer, locty, "tpm_data_write");
if (n > 0) {
/* sending of data was successful */
s->offset = 0;
/*
* Send a TPM request.
*/
-static int TPM_Send(tpmState *s, tpmBuffer *buffer, char *msg)
+static int TPM_Send(tpmState *s, tpmBuffer *buffer, uint8_t locty, char *msg)
{
int len;
uint32_t size = tpm_get_size_from_buffer(buffer->buf);
showBuff(buffer->buf, "To TPM");
#endif
+ /* transmit the locality in the highest 3 bits */
+ buffer->instance[0] &= 0x1f;
+ buffer->instance[0] |= (locty << 5);
+
len = vTPMTransmit[s->Transmitlayer].write(s, buffer);
if (len < 0) {
s->Transmitlayer = -1;